<template>
  <a-modal :maskClosable="false"
    :title='title'
    :width='800'
    :visible='visible'
    :confirmLoading='confirmLoading'
    @ok='handleOk'
    @cancel='handleCancel'
    cancelText='关闭'
    wrapClassName='ant-modal-cust-warp'
    style='top:5%;height: 85%;overflow-y: hidden'>

    <a-card :bordered='false' class='card-area'>
      <a-table
        ref='table'
        size='middle'
        bordered
        rowKey='id'
        :dataSource='dataSource'
        :pagination='ipagination'
        :loading='loading'
        :customRow='doubleClick'
        :rowSelection='{type:selectedType, selectedRowKeys: selectedRowKeys, onChange: onSelectChange }'>
        <a-table-column title='姓名' align='center' dataIndex='realname'></a-table-column>
        <a-table-column title='性别' align='center' dataIndex='sex'></a-table-column>
        <a-table-column title='手机号' align='center' dataIndex='phone'></a-table-column>
        <a-table-column title='所属部们' align='center' dataIndex='post'></a-table-column>
        <a-table-column title='在职情况' align='center' dataIndex='workNo'></a-table-column>
      </a-table>
    </a-card>
  </a-modal>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '@api/manage'
import { filterObj } from '@/utils/util'

export default {
  name: 'DepartList',
  mixins: [JeecgListMixin],
  data() {
    return {
      description: '员工信息',
      visible: false,
      title: '请选择员工',
      confirmLoading: false,
      /* table选择类型，单选radio或多选checkbox  */
      selectedType: 'radio',
      selectedRowKeys:[],
      // 查询条件
      queryParam: {
        spellRoom:0,
      },
      columns:[],
      flag:false,
      url: {
        list: '/his/personnel/list'
      },
      loading: false
    }
  },
  computed: {},
  created() {

  },
  methods: {
    doubleClick(record, index) {
      var that = this
      return {
        on: {
          // 这里是双击，单击改成click即可
          dblclick: () => {
            if (that.selectedType == 'radio') {
              that.selectedRowKeys=[];
              that.$emit('signOk', record)
              that.close()
            }
          }
        }
      }
    },
    show(flag) {
      this.flag=flag;
      this.visible = true
    },
    handleOk() {
      const that = this
      that.selectedRowKeys=[];
      if (that.selectedType == 'radio') {
        that.$emit('signOk', this.selectionRows[0])
      } else {
        that.$emit('signOk', this.selectionRows)
      }
      that.close()
    },
    handleCancel() {
      this.close()
    },
    close() {
      this.visible = false
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>